package data_structures_and_algorithms.tree.learn;

import common.TreeNode;

/**
 * @ClassName Code_zuo_god_maxBinarySearchTree_head_In_tree
 * @Description: 获取一个树中最大的二叉搜索树的头节点
 * @Author: yongliang.ma
 * @Create_time:2022/10/30 18:36
 */
public class Code_zuo_god_maxBinarySearchTree_head_In_tree {



    public TreeNode getMaxBinarySearchHead(TreeNode root){
        return null;
    }

    public class Info{
        public boolean isBS;
        public int maxNum;
        public int minNum;
        public Info(boolean isBS, int maxNum, int minNum){
            this.isBS = isBS;
            this.maxNum = maxNum;
            this.minNum = minNum;
        }
    }

    public Info dfs(TreeNode node){
        if (node == null)
            return null;

        Info LInfo = dfs(node.left);
        Info RInfo = dfs(node.right);

        boolean isBS = true;
        int maxNum = node.val;
        int minNum = node.val;
        if (LInfo != null){

        }

        if (RInfo != null){

        }


        if (LInfo.isBS && RInfo.isBS && node.val > LInfo.maxNum && node.val < RInfo.minNum){
            isBS = true;
        }
        return new Info(isBS, RInfo.maxNum, LInfo.minNum);
    }



}
